import java.util.ArrayList;
import java.util.Arrays;

public class Selflearn_21 {
    //practice Arraylist(methods from "Collection")
    public static void main(String[] args){
        ArrayList<Integer> integerArrayList=new ArrayList<>();
        System.out.println(""+integerArrayList.size()+integerArrayList.isEmpty());//1
        for(int i=0;i<10;i++){
            integerArrayList.add(i+1);
        }
        System.out.println(integerArrayList);//2
        System.out.println(integerArrayList.contains(3));//3
        System.out.println(integerArrayList.contains(114514));//4
        ArrayList<Integer> test=new ArrayList<>();
        test.add(1);
        test.add(4);
        System.out.println(integerArrayList.containsAll(test));//5
        integerArrayList.addAll(test);
        Integer i=4;
        integerArrayList.remove(i);
        System.out.println(integerArrayList);//6
        integerArrayList.add(4);
        integerArrayList.add(4);
        integerArrayList.remove(test);
        System.out.println(integerArrayList);//7
        test.clear();
        integerArrayList.add(5);
        test.add(3);
        test.add(5);
        integerArrayList.retainAll(test);
        System.out.println(integerArrayList+"   "+integerArrayList.equals(test));//8
        Integer[] a = integerArrayList.toArray(new Integer[0]);
        System.out.println(Arrays.toString(a));//9
    }
}
